<?php
class Index extends Controller {
	public function html() {
		$mUser = new User_model();
		$currUser = $mUser->currUser();
		if(!$currUser) header('Location:/auth/login?backurl='.urlencode('/yunying/product/'));
		
		$page = $this->post('page', 'int');
		$size = 20;
		
		$id = $this->get('id', 'int');
		if(!$id) header('Location:/yunying/product/');
		
		//获取景点信息
		$mProduct = new Product_model();
		//获取景点信息
		$data['info'] = $mProduct->productInfo(array('id' => $id));
		$data['id'] = $id;
		$tpl = 'yunying/product/picture/index.html';
		
		include SERVER_PATH.'/extend/upload.extend.php';
		$config = include SERVER_PATH.'/config/upload.php';
		$app = "productImage";
		$data['hash'] = Upload_extend::hash($app, $config[$app]['secret']);
		$data['app'] = $app;
		
		$mPicture = new Picture_model();
		$params = array('pid' => $id);
		$picture = $mPicture->page($page, $size, $params);
		$data['picture'] = $picture;
		
		$this->display($data, $tpl);
	}
}